package com.netease.xone.fragment;

import Utils.StackTraceUtil;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.widget.CursorAdapter;

import com.netease.log.NTLog;
import com.netease.xone.R;
import com.netease.xone.adapter.AdapterTip;
import com.netease.xone.itemview.ItemViewTipBase;


public class FragmentTipTopic extends FragmentTipBase {
    private static final String TAG = FragmentTipTopic.class.getSimpleName();
    
    public static FragmentTipTopic newInstance(Parcelable obj) {
        FragmentTipTopic f = new FragmentTipTopic();
        Bundle b = new Bundle();
        b.putParcelable("obj", obj);
        f.setArguments(b);
        return f;
    }
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        NTLog.d(TAG, StackTraceUtil.getMethodName()
                + " savedInstanceState=" + (null == savedInstanceState ? "null" : savedInstanceState.toString()));
        super.onCreate(savedInstanceState);
        mType = ItemViewTipBase.TYPE_TOPIC;
        getSherlockActivity().getSupportActionBar().setTitle(R.string.discuss_title_topic);
    }
    
    @Override
    protected CursorAdapter getAdapter() {
        NTLog.d(TAG, StackTraceUtil.getMethodName());
        AdapterTip adapter = null;
        adapter = new AdapterTip(getActivity(), null, ItemViewTipBase.TYPE_TOPIC);
        return adapter;
    }

    @Override
    protected String getItemInfo(Object obj, int position) {
        String value = null;
        do {
            if (null == obj) {
                break;
            }
            if (obj instanceof String) {
                value = "#" + (String)obj + "# ";
            }
        } while (false);
        return value;
    }
}
